bitkeeper revision 1.1108.48.1 (410e1948_L7KCN9h17cq5QeBniYH6g)
authorcl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Mon, 2 Aug 2004 10:36:56 +0000 (10:36 +0000)
committercl349@freefall.cl.cam.ac.uk <cl349@freefall.cl.cam.ac.uk>
Mon, 2 Aug 2004 10:36:56 +0000 (10:36 +0000)
use the tsc to interpolate time values when the time structure in shared_info
isn't quite uptodate

linux-2.4.26-xen-sparse/arch/xen/kernel/time.c
linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c
linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c

index caf89614a3f66206b818e650072341aceb0ebea7..825b188d65c7e721ac1438f19e4e7cb892a8fdf4 100644 (file)
@@ -391,7 +391,8 @@ static inline void do_timer_interrupt(int irq, void *dev_id,
 
     __get_time_values_from_xen();
 
-    if ( (delta = (s64)(shadow_system_time - processed_system_time)) < 0 )
+    if ( (delta = (s64)(shadow_system_time + __get_time_delta_usecs() * 1000 -
+                                               processed_system_time)) < 0 )
     {
         printk("Timer ISR: Time went backwards: %lld\n", delta);
         return;
index 276a61f6956d25d810ada335c29384ca09dbe05b..82a8a91d8164887dbde1320b17745c6673faaea8 100644 (file)
@@ -88,6 +88,7 @@ EXPORT_SYMBOL(i8253_lock);
 struct timer_opts *cur_timer = &timer_none;
 
 extern u64 shadow_system_time;
+extern u32 shadow_time_delta_usecs;
 extern void __get_time_values_from_xen(void);
 
 /* Keep track of last time we did processing/updating of jiffies and xtime. */
@@ -300,7 +301,9 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        __get_time_values_from_xen();
 
-       delta = (s64)(shadow_system_time - processed_system_time);
+       shadow_time_delta_usecs = cur_timer->get_offset() * NSEC_PER_USEC;
+       delta = (s64)(shadow_system_time + shadow_time_delta_usecs -
+                     processed_system_time);
        if (delta < 0) {
                printk("Timer ISR: Time went backwards: %lld\n", delta);
                goto out;
index eca23fd67743e321f5f4b551f6f7f401414206e3..623b85c9dee7387dbf692fd206a74caaf9eb5a8b 100644 (file)
@@ -85,6 +85,7 @@ static u32 shadow_tsc_stamp;
 u64 shadow_system_time;
 static u32 shadow_time_version;
 static struct timeval shadow_tv;
+u32 shadow_time_delta_usecs;
 static unsigned int rdtsc_bitshift;
 extern u64 processed_system_time;
 
@@ -192,7 +193,8 @@ static void mark_offset_tsc(void)
 
        write_seqlock(&monotonic_lock);
 
-       delta = (s64)(shadow_system_time - processed_system_time);
+       delta = (s64)(shadow_system_time + shadow_time_delta_usecs -
+                     processed_system_time);
 
        /* Process elapsed jiffies since last call. */
        while (delta >= NS_PER_TICK) {